var baseurl = "http://ui11.hfjava.com"

function ajax(url,param,f){
    $.ajax({
        type:"POST",
        url:baseurl+url,
        contentType:"application/json; charset=utf-8",
        data:JSON.stringify(param),
        success:function(data){
            f(data);
        }
    });
}

var issend = false;
function sendMsg(telValue,isRealSend){
        if(issend){
            return;
        }

        issend = true;

        var i = 60;

        getyzmbtn.innerHTML =  i+"s后重新获取";

        var timer = setInterval(function(){
            i--;
            if(i==0){
                getyzmbtn.innerHTML = "获取验证码";
                clearInterval(timer);
                tip.innerHTML = "";
                issend = false;
                return;
            }
            getyzmbtn.innerHTML =  i+"s后重新获取";
        },1000);

        //发短信
        if(isRealSend){
            $.ajax({
                type:"POST",
                url:baseurl+"/bijiyzm/add",
                contentType : "application/json; charset=utf-8", //会发一个用UTF-8编码的JSON的字符串给服务器
                data:JSON.stringify({
                    tel:telValue
                }),
                success:function(data){
                    if(data){
                        tip.innerHTML = "短信已经发送！";
                    }else{
                        tip.innerHTML = "短信发送失败！";
                    }
                }
            })
        }
}